package com.zbkj.dal.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

@Getter
@AllArgsConstructor
public enum DuesStatusEnums {

    UNPAID(2, "待支付"),
    PAID(1, "已支付"),
    CANCEL(0, "已取消"),
    ;
    private final Integer code;
    private final String desc;

    public static String getCodeByDesc(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        return Arrays.stream(DuesStatusEnums.values()).filter(e -> e.getCode().equals(code)).map(DuesStatusEnums::getDesc).findFirst().orElse(null);
    }
}
